package prist;

import java.util.HashMap;
import java.util.Scanner;

public class Threads {
    public static HashMap<Object, Integer> thread;

    public Threads() {
    }

    //初始化线程所需要的资源
    public void Init_Threads() {
        thread = new HashMap<Object, Integer>();
        int count;
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入线程所需要的资源种类：");
        count = sc.nextInt();
        String thread_resource;
        Integer thread_number;
        for (int i = 0; i < count; i++) {
            thread_resource = sc.next();
            thread_number = sc.nextInt();
            thread.put(thread_resource, thread_number);
        }
    }

    public static HashMap<Object, Integer> getThread() {
        return thread;
    }

    public static void setThread(HashMap<Object, Integer> thread) {
        Threads.thread = thread;
    }
}
